﻿namespace ExamV5.GradeInfo
{
    using ExamV5;
    using System;
    using System.Configuration;
    using System.Data;
    using System.Data.SqlClient;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;

    public class FrmShowWriteUser : Page
    {
        protected Button butClose;
        protected HtmlForm form1;
        protected HtmlHead Head1;
        private HttpCookie httpCookie_0 = null;
        private HttpCookie httpCookie_1 = null;
        private HttpCookie httpCookie_2 = null;
        private HttpCookie httpCookie_3 = null;
        private int int_0 = 0;
        private int int_1 = 0;
        protected Label labDiff;
        protected Label labErrotUserList;
        protected Label labFlag;
        protected Label labOKAnswer;
        protected Label labOKMemo;
        protected Label labOKUserList;
        protected Label labOptionAnswer;
        protected Label labRubricDoc;
        protected Label labRubricType;
        protected Label labSubjectName;
        private PublicFun publicFun_0 = new PublicFun();

        private void method_0()
        {
            string cmdText = "";
            int num = 0;
            string str2 = "RubricS";
            string str3 = "RubricSFen";
            switch (this.ViewState["RubricType"].ToString())
            {
                case "A":
                    num = 0;
                    str2 = "RubricS";
                    str3 = "RubricSFen";
                    break;

                case "B":
                    num = 1;
                    str2 = "RubricD";
                    str3 = "RubricDFen";
                    break;

                case "C":
                    num = 2;
                    str2 = "RubricB";
                    str3 = "RubricBFen";
                    break;

                case "D":
                    num = 3;
                    str2 = "RubricF";
                    str3 = "CheckUserFFen";
                    break;

                case "E":
                    num = 4;
                    str2 = "RubricA";
                    str3 = "CheckUserAFen";
                    break;

                case "F":
                    num = 5;
                    str2 = "RubricC";
                    str3 = "CheckUserCFen";
                    break;

                case "G":
                    num = 6;
                    str2 = "RubricT";
                    str3 = "CheckUserTFen";
                    break;

                case "H":
                    num = 7;
                    str2 = "RubricAn";
                    str3 = "CheckUserAnFen";
                    break;

                case "I":
                    num = 8;
                    str2 = "RubricO";
                    str3 = "CheckUserOFen";
                    break;

                case "J":
                    num = 9;
                    str2 = "RubricJ";
                    str3 = "CheckUserJFen";
                    break;
            }
            this.labOKUserList.Text = "";
            this.labErrotUserList.Text = "";
            cmdText = string.Concat(new object[] { "select a.UserCode,a.UserName,b.", str2, ",c.", str3, ",b.SortInfo from UserInfo a,PaperData b,CheckPaper C where a.UserCode=b.UserCode and b.UserCode=c.UserCode and b.PaperID=c.PaperID and b.PaperID=", this.int_1 });
            SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
            connection.Open();
            SqlCommand command = new SqlCommand(cmdText, connection);
            SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
            while (reader.Read())
            {
                this.method_1(reader[0].ToString(), reader[1].ToString(), reader[2].ToString(), reader[3].ToString(), reader[4].ToString(), num);
            }
            reader.Close();
            command.Dispose();
            connection.Close();
            connection.Dispose();
        }

        private void method_1(string string_0, string string_1, string string_2, string string_3, string string_4, int int_2)
        {
            int index = 0;
            string cmdText = "";
            string[] strArray = string_4.Split(new char[] { '#' });
            string[] strArray2 = string_3.Split(new char[] { '|' });
            cmdText = "select ID from RubricInfo  ";
            if (string_2.Trim().Length > 1)
            {
                string_2 = string_2.Substring(0, string_2.Length - 1);
                string_2 = string_2.Replace("#", ",");
            }
            else
            {
                string_2 = "0,0";
            }
            cmdText = (cmdText + " where ID in(" + string_2 + ")") + " order by " + strArray[int_2];
            SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
            connection.Open();
            SqlCommand command = new SqlCommand(cmdText, connection);
            SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
            while (reader.Read())
            {
                if (reader["ID"].ToString() == this.int_0.ToString())
                {
                    if (!(strArray2[index].Trim() != ""))
                    {
                        this.labErrotUserList.Text = this.labErrotUserList.Text + string_1 + "[" + string_0 + "],";
                    }
                    else if (Convert.ToDouble(strArray2[index].Trim()) <= 0.0)
                    {
                        this.labErrotUserList.Text = this.labErrotUserList.Text + string_1 + "[" + string_0 + "],";
                    }
                    else
                    {
                        this.labOKUserList.Text = this.labOKUserList.Text + string_1 + "[" + string_0 + "],";
                    }
                    break;
                }
                index++;
            }
            reader.Close();
            command.Dispose();
            connection.Close();
            connection.Dispose();
        }

        private void method_2()
        {
            try
            {
                string[] strArray;
                int num2;
                int num4;
                string[] strArray2;
                int num5;
                string[] strArray3;
                string str2 = "";
                SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
                connection.Open();
                SqlCommand command = new SqlCommand("select a.IsDel,a.CreatNumberNO,a.CreatTime,a.ID,b.SubjectName,a.RubricType,a.RubricTitle,a.Difficulty,a.OptionAnswer,a.OKAnswer,a.IsShare,a.ISCheck,a.Flag,a.IsUse,a.OKMemo from RubricInfo a,SubjectInfo b  where b.ID=a.SubjectID and a.ID=" + this.int_0, connection);
                SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
                if (!reader.Read())
                {
                    goto Label_0ACF;
                }
                this.labOKMemo.Text = reader["OKMemo"].ToString();
                str2 = reader["OptionAnswer"].ToString();
                switch (reader["Flag"].ToString())
                {
                    case "A":
                        this.labFlag.Text = "正规考试题库";
                        break;

                    case "B":
                        this.labFlag.Text = "练习题库";
                        break;

                    case "C":
                        this.labFlag.Text = "模拟考试题库";
                        break;

                    case "D":
                        this.labFlag.Text = "竞赛题库";
                        break;

                    case "E":
                        this.labFlag.Text = "每日一题题库";
                        break;
                }
                this.labSubjectName.Text = reader["SubjectName"].ToString();
                this.labRubricType.Text = this.publicFun_0.GetRubricType(reader["RubricType"].ToString(), "0");
                this.ViewState["RubricType"] = reader["RubricType"].ToString();
                switch (reader["RubricType"].ToString())
                {
                    case "A":
                        strArray3 = str2.Split(new char[] { '#' });
                        num5 = 0;
                        goto Label_0446;

                    case "B":
                        strArray2 = str2.Split(new char[] { '#' });
                        num4 = 0;
                        goto Label_060D;

                    case "C":
                        this.labOptionAnswer.Text = str2;
                        if (!(reader["OKAnswer"].ToString() == "Y"))
                        {
                            goto Label_068B;
                        }
                        this.labOKAnswer.Text = "正确";
                        goto Label_09F8;

                    case "D":
                        this.labOptionAnswer.Text = str2;
                        strArray = reader["OKAnswer"].ToString().Split(new char[] { '#' });
                        num2 = 0;
                        goto Label_0855;

                    case "E":
                        this.labOptionAnswer.Text = str2;
                        this.labOKAnswer.Text = reader["OKAnswer"].ToString();
                        goto Label_09F8;

                    case "F":
                        this.labOptionAnswer.Text = str2;
                        this.labOKAnswer.Text = reader["OKAnswer"].ToString();
                        goto Label_09F8;

                    case "G":
                        this.labOptionAnswer.Text = str2;
                        this.labOKAnswer.Text = reader["OKAnswer"].ToString();
                        goto Label_09F8;

                    case "H":
                        this.labOptionAnswer.Text = str2;
                        this.labOKAnswer.Text = reader["OKAnswer"].ToString();
                        goto Label_09F8;

                    case "I":
                        if (str2.Trim() != "")
                        {
                            goto Label_0942;
                        }
                        this.labOptionAnswer.Text = "";
                        goto Label_095D;

                    case "J":
                        this.labOptionAnswer.Text = str2;
                        this.labOKAnswer.Text = reader["OKAnswer"].ToString().Replace("#", "、");
                        goto Label_09F8;

                    default:
                        goto Label_09F8;
                }
            Label_02CD:
                if (strArray3[num5].ToString() != "")
                {
                    this.labOptionAnswer.Text = this.labOptionAnswer.Text + "<br>";
                    switch (num5)
                    {
                        case 0:
                            this.labOptionAnswer.Text = this.labOptionAnswer.Text + "A、" + strArray3[num5].ToString();
                            break;

                        case 1:
                            this.labOptionAnswer.Text = this.labOptionAnswer.Text + "B、" + strArray3[num5].ToString();
                            break;

                        case 2:
                            this.labOptionAnswer.Text = this.labOptionAnswer.Text + "C、" + strArray3[num5].ToString();
                            break;

                        case 3:
                            this.labOptionAnswer.Text = this.labOptionAnswer.Text + "D、" + strArray3[num5].ToString();
                            break;

                        case 4:
                            this.labOptionAnswer.Text = this.labOptionAnswer.Text + "E、" + strArray3[num5].ToString();
                            break;

                        case 5:
                            this.labOptionAnswer.Text = this.labOptionAnswer.Text + "F、" + strArray3[num5].ToString();
                            break;
                    }
                }
                num5++;
            Label_0446:
                if (num5 < strArray3.Length)
                {
                    goto Label_02CD;
                }
                this.labOKAnswer.Text = reader["OKAnswer"].ToString();
                goto Label_09F8;
            Label_0494:
                if (strArray2[num4].ToString() != "")
                {
                    this.labOptionAnswer.Text = this.labOptionAnswer.Text + "<br>";
                    switch (num4)
                    {
                        case 0:
                            this.labOptionAnswer.Text = this.labOptionAnswer.Text + "A、" + strArray2[num4].ToString();
                            break;

                        case 1:
                            this.labOptionAnswer.Text = this.labOptionAnswer.Text + "B、" + strArray2[num4].ToString();
                            break;

                        case 2:
                            this.labOptionAnswer.Text = this.labOptionAnswer.Text + "C、" + strArray2[num4].ToString();
                            break;

                        case 3:
                            this.labOptionAnswer.Text = this.labOptionAnswer.Text + "D、" + strArray2[num4].ToString();
                            break;

                        case 4:
                            this.labOptionAnswer.Text = this.labOptionAnswer.Text + "E、" + strArray2[num4].ToString();
                            break;

                        case 5:
                            this.labOptionAnswer.Text = this.labOptionAnswer.Text + "F、" + strArray2[num4].ToString();
                            break;
                    }
                }
                num4++;
            Label_060D:
                if (num4 < strArray2.Length)
                {
                    goto Label_0494;
                }
                this.labOKAnswer.Text = reader["OKAnswer"].ToString().Replace("#", "、");
                goto Label_09F8;
            Label_068B:
                this.labOKAnswer.Text = "错误";
                goto Label_09F8;
            Label_06DC:
                if (strArray[num2].ToString() != "")
                {
                    this.labOKAnswer.Text = this.labOKAnswer.Text + "<br>";
                    switch (num2)
                    {
                        case 0:
                            this.labOKAnswer.Text = this.labOKAnswer.Text + "1、" + strArray[num2].ToString();
                            break;

                        case 1:
                            this.labOKAnswer.Text = this.labOKAnswer.Text + "2、" + strArray[num2].ToString();
                            break;

                        case 2:
                            this.labOKAnswer.Text = this.labOKAnswer.Text + "3、" + strArray[num2].ToString();
                            break;

                        case 3:
                            this.labOKAnswer.Text = this.labOKAnswer.Text + "4、" + strArray[num2].ToString();
                            break;

                        case 4:
                            this.labOKAnswer.Text = this.labOKAnswer.Text + "5、" + strArray[num2].ToString();
                            break;

                        case 5:
                            this.labOKAnswer.Text = this.labOKAnswer.Text + "6、" + strArray[num2].ToString();
                            break;
                    }
                }
                num2++;
            Label_0855:
                if (num2 < strArray.Length)
                {
                    goto Label_06DC;
                }
                goto Label_09F8;
            Label_0942:
                this.labOptionAnswer.Text = "<a href='../FrmDownLoad.aspx?FileName=" + str2 + "' target='_blank'>查看原题</a>";
            Label_095D:
                if (!(reader["OKAnswer"].ToString().Trim() != ""))
                {
                    this.labOKAnswer.Text = "";
                }
                else
                {
                    this.labOKAnswer.Text = "<a href='../FrmDownLoad.aspx?FileName=" + reader["OKAnswer"].ToString() + "' target='_blank'>查看答案</a>";
                }
            Label_09F8:
                this.labRubricDoc.Text = reader["RubricTitle"].ToString();
                string str4 = reader["Difficulty"].ToString();
                switch (str4)
                {
                    case null:
                        break;

                    case "A":
                        this.labDiff.Text = "难";
                        break;

                    case "B":
                        this.labDiff.Text = "较难";
                        break;

                    case "C":
                        this.labDiff.Text = "中等";
                        break;

                    default:
                        if (!(str4 == "D"))
                        {
                            if (str4 == "E")
                            {
                                this.labDiff.Text = "容易";
                            }
                        }
                        else
                        {
                            this.labDiff.Text = "较易";
                        }
                        break;
                }
            Label_0ACF:
                reader.Close();
                command.Dispose();
                connection.Close();
                connection.Dispose();
            }
            catch
            {
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            this.httpCookie_0 = new HttpCookie("ExamUserCode");
            this.httpCookie_0 = base.Request.Cookies["ExamUserCode"];
            this.httpCookie_1 = new HttpCookie("ExamUserName");
            this.httpCookie_1 = base.Request.Cookies["ExamUserName"];
            this.httpCookie_2 = new HttpCookie("ExamUserLevel");
            this.httpCookie_2 = base.Request.Cookies["ExamUserLevel"];
            this.httpCookie_3 = new HttpCookie("ExamDeptID");
            this.httpCookie_3 = base.Request.Cookies["ExamDeptID"];
            this.int_0 = Convert.ToInt32(base.Request["ID"].ToString());
            this.int_1 = Convert.ToInt32(base.Request["PaperID"].ToString());
            if ((this.httpCookie_0 != null) ? !(this.httpCookie_0.Value == "") : false)
            {
                base.Response.Cache.SetCacheability(HttpCacheability.NoCache);
                base.Response.Cache.SetNoStore();
                this.httpCookie_0.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_0.Value));
                this.httpCookie_1.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_1.Value));
                this.httpCookie_2.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_2.Value));
                this.httpCookie_3.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_3.Value));
                this.Page.Title = ConfigurationManager.ConnectionStrings["ProTitle"].ConnectionString;
                if (!base.IsPostBack)
                {
                    if (!(this.publicFun_0.ReturnPaperData() != "Yes"))
                    {
                        if (!((this.int_0 != 0) ? !(this.httpCookie_2.Value != "A") : true))
                        {
                            this.method_2();
                            this.method_0();
                        }
                    }
                    else
                    {
                        base.Response.Write("<script>alert('此版本暂未授权,请拔打(0)13870606104手机号进行授权！')</script>");
                    }
                }
            }
            else
            {
                base.Response.Write("<script language=javascript>top.location.href='../Index.htm';self.close();</script>");
            }
        }
    }
}

